const { ref, onMounted } = Vue;
const ElementPlus = window.ElementPlus;

export default {
  components: { ...ElementPlus },
  props: {
    title: { type: String, required: true }
  },
  template: `
    <el-row class="header">
      <el-col :span="6"><img src="../images/aeec_logo.png" height="60" alt="黎阳LOGO" /></el-col>
      <el-col :span="12" class="header-title">{{title}}</el-col>
      <el-col :span="6" class="currentTime">{{currentTime}}</el-col>
    </el-row>
  `,
  setup(props) {
    const currentTime = ref('');
    const title = props.title;
    onMounted(async () => {
      let incrementNumber = () => {
        setTimeout(incrementNumber, 500);
        currentTime.value = dayjs().format('YYYY年MM月DD日  HH:mm:ss');
      }
      setTimeout(incrementNumber, 500);
    });

    return {
      currentTime, title
    }
  },
};